//auto gen by paipai.java.augogen ver 3.0.0
//author skyzhuang
//source idl: com.erp.helloworld.dao.idl.AddHelloWorldReq.java


#ifndef ERP_HELLOWORLD_DDO_CHELLOWORLDDDO_BY_AUTOGEN_V5_H
#define ERP_HELLOWORLD_DDO_CHELLOWORLDDDO_BY_AUTOGEN_V5_H


#include "app_platform/intf_serializable.h"
#include <string>
#include <sstream>
#include <iostream>


namespace erp
{
namespace helloworld
{
namespace ddo
{


class CHelloWorldDdo : public ISerializable
{
	public:
		std::string m_sLastErrMsg;///<错误信息

		/**
		 *  版本号   
		 *
		 * 版本 >= 0
		 */
		uint32_t dwVersion;

		/**
		 * 版本 >= 0
		 */
		uint8_t cVersion_u;

		/**
		 *  HelloWorld ID 
		 *
		 * 版本 >= 0
		 */
		uint32_t dwHelloWorldID;

		/**
		 * 版本 >= 0
		 */
		uint8_t cHelloWorlD_u;

		/**
		 *  HelloWorld 名称 
		 *
		 * 版本 >= 0
		 */
		std::string strHelloWorldName;

		/**
		 * 版本 >= 0
		 */
		uint8_t cHelloWorldName_u;

		/**
		 *  添加时间
		 *
		 * 版本 >= 0
		 */
		uint32_t dwCreateTime;

		/**
		 * 版本 >= 0
		 */
		uint8_t cCreateTime_u;

		/**
		 *  修改时间
		 *
		 * 版本 >= 0
		 */
		uint32_t dwLastUpdateTime;

		/**
		 * 版本 >= 0
		 */
		uint8_t cLastUpdateTime_u;




	public:
		CHelloWorldDdo():
		dwVersion(0),
		cVersion_u(0),
		dwHelloWorldID(0),
		cHelloWorlD_u(0),
		cHelloWorldName_u(0),
		dwCreateTime(0),
		cCreateTime_u(0),
		dwLastUpdateTime(0),
		cLastUpdateTime_u(0) {}
				CHelloWorldDdo& operator = (const CHelloWorldDdo& obj){

			this->dwVersion = obj.dwVersion;
			this->cVersion_u = obj.cVersion_u;
			this->dwHelloWorldID = obj.dwHelloWorldID;
			this->cHelloWorlD_u = obj.cHelloWorlD_u;
			this->strHelloWorldName = obj.strHelloWorldName;
			this->cHelloWorldName_u = obj.cHelloWorldName_u;
			this->dwCreateTime = obj.dwCreateTime;
			this->cCreateTime_u = obj.cCreateTime_u;
			this->dwLastUpdateTime = obj.dwLastUpdateTime;
			this->cLastUpdateTime_u = obj.cLastUpdateTime_u;
			return *this;
		}

	public:


		/**
		 * 是否设置 版本号   了
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 bool  IsVersionSet() const{
				 return  cVersion_u != 0;
		}


		/**
		 * 获取uflag 版本号   了
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 const uint8_t   GetVersionUFlag() const{
				 return  cVersion_u;
		}


		/**
		 * 设置 版本号   
		 * 
		 * @param uint32_t:dwVersion
		 *  
		 * 
		 */
		 void  SetVersion( const uint32_t& sVal, uint8_t cUFlag=1){
				dwVersion = sVal;
				cVersion_u = cUFlag;
		}


		/**
		 * 获取 版本号   
		 * 
		 * @return dwVersion value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetVersion() const {
				return dwVersion;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cVersion_u
		 *  
		 * 
		 */
		 void  SetVersion_u( const uint8_t& sVal){
				cVersion_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cVersion_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetVersion_u() const {
				return cVersion_u;
		}


		/**
		 * 设置 HelloWorld ID 
		 * 
		 * 此字段的版本 >= 0
		 * @param uint32_t:dwHelloWorldID
		 *  
		 * 
		 */
		 void  SetHelloWorldID( const uint32_t& sVal){
				dwHelloWorldID = sVal;
		}


		/**
		 * 获取 HelloWorld ID 
		 * 
		 * @return dwHelloWorldID value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetHelloWorldID() const {
				return dwHelloWorldID;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cHelloWorlD_u
		 *  
		 * 
		 */
		 void  SetHelloWorlD_u( const uint8_t& sVal){
				cHelloWorlD_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cHelloWorlD_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetHelloWorlD_u() const {
				return cHelloWorlD_u;
		}


		/**
		 * 是否设置 HelloWorld 名称 了
		 * 
		 * @param std::string:strHelloWorldName
		 *  
		 * 
		 */
		 bool  IsHelloWorldNameSet() const{
				 return  cHelloWorldName_u != 0;
		}


		/**
		 * 获取uflag HelloWorld 名称 了
		 * 
		 * @param std::string:strHelloWorldName
		 *  
		 * 
		 */
		 const uint8_t   GetHelloWorldNameUFlag() const{
				 return  cHelloWorldName_u;
		}


		/**
		 * 设置 HelloWorld 名称 
		 * 
		 * @param std::string:strHelloWorldName
		 *  
		 * 
		 */
		 void  SetHelloWorldName( const std::string& sVal, uint8_t cUFlag=1){
				strHelloWorldName = sVal;
				cHelloWorldName_u = cUFlag;
		}


		/**
		 * 获取 HelloWorld 名称 
		 * 
		 * @return strHelloWorldName value 类型为:std::string
		 * 
		 */
		 const std::string&  GetHelloWorldName() const {
				return strHelloWorldName;
		}


		/**
		 * 获取 HelloWorld 名称 
		 * 
		 * @return strHelloWorldName value 类型为:std::string
		 * 
		 */
		 std::string&  GetHelloWorldName() {
				return strHelloWorldName;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cHelloWorldName_u
		 *  
		 * 
		 */
		 void  SetHelloWorldName_u( const uint8_t& sVal){
				cHelloWorldName_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cHelloWorldName_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetHelloWorldName_u() const {
				return cHelloWorldName_u;
		}


		/**
		 * 是否设置 添加时间了
		 * 
		 * @param uint32_t:dwCreateTime
		 *  
		 * 
		 */
		 bool  IsCreateTimeSet() const{
				 return  cCreateTime_u != 0;
		}


		/**
		 * 获取uflag 添加时间了
		 * 
		 * @param uint32_t:dwCreateTime
		 *  
		 * 
		 */
		 const uint8_t   GetCreateTimeUFlag() const{
				 return  cCreateTime_u;
		}


		/**
		 * 设置 添加时间
		 * 
		 * @param uint32_t:dwCreateTime
		 *  
		 * 
		 */
		 void  SetCreateTime( const uint32_t& sVal, uint8_t cUFlag=1){
				dwCreateTime = sVal;
				cCreateTime_u = cUFlag;
		}


		/**
		 * 获取 添加时间
		 * 
		 * @return dwCreateTime value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetCreateTime() const {
				return dwCreateTime;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cCreateTime_u
		 *  
		 * 
		 */
		 void  SetCreateTime_u( const uint8_t& sVal){
				cCreateTime_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cCreateTime_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetCreateTime_u() const {
				return cCreateTime_u;
		}


		/**
		 * 是否设置 修改时间了
		 * 
		 * @param uint32_t:dwLastUpdateTime
		 *  
		 * 
		 */
		 bool  IsLastUpdateTimeSet() const{
				 return  cLastUpdateTime_u != 0;
		}


		/**
		 * 获取uflag 修改时间了
		 * 
		 * @param uint32_t:dwLastUpdateTime
		 *  
		 * 
		 */
		 const uint8_t   GetLastUpdateTimeUFlag() const{
				 return  cLastUpdateTime_u;
		}


		/**
		 * 设置 修改时间
		 * 
		 * @param uint32_t:dwLastUpdateTime
		 *  
		 * 
		 */
		 void  SetLastUpdateTime( const uint32_t& sVal, uint8_t cUFlag=1){
				dwLastUpdateTime = sVal;
				cLastUpdateTime_u = cUFlag;
		}


		/**
		 * 获取 修改时间
		 * 
		 * @return dwLastUpdateTime value 类型为:uint32_t
		 * 
		 */
		 const uint32_t&  GetLastUpdateTime() const {
				return dwLastUpdateTime;
		}


		/**
		 * 设置
		 * 
		 * 此字段的版本 >= 1
		 * @param uint8_t:cLastUpdateTime_u
		 *  
		 * 
		 */
		 void  SetLastUpdateTime_u( const uint8_t& sVal){
				cLastUpdateTime_u = sVal;
		}


		/**
		 * 获取
		 * 
		 * @return cLastUpdateTime_u value 类型为:uint8_t
		 * 
		 */
		 const uint8_t&  GetLastUpdateTime_u() const {
				return cLastUpdateTime_u;
		}

		virtual bool Serialize(CByteStreamNetwork& bs){
		
			uint32_t dwMyLen = 0;
			if(bs.isStoring()) //for write in buffer
			{
				//can not larger than 1 M.
				CByteStreamNetwork bsDummy(NULL, 1024 * 1024, false);
				//bsDummy for precheck the xo size...
				bsDummy.isStoring(true);
				Serialize_i(bsDummy);
				dwMyLen = bsDummy.getWrittenLength();
				bs & dwMyLen;
				Serialize_i(bs);
			}
			else
			{    //for read from buffer
				bs & dwMyLen;
				uint32_t dwReadedLen = bs.getReadLength();
				Serialize_i(bs);
				dwReadedLen = bs.getReadLength() - dwReadedLen;
				// dwReadedLen for the size of xo
				if( dwReadedLen > dwMyLen ){
					return false;
				}
				//go through the unwanted mem position...
				bs.goForward( dwMyLen - dwReadedLen );
			}

			return bs.isGood();
		}

		bool Serialize_i(CByteStreamNetwork& bsTmp){

			bsTmp & dwVersion; // 序列化 版本号    类型为uint32_t
			bsTmp & cVersion_u; // 序列化 类型为uint8_t
			bsTmp & dwHelloWorldID; // 序列化 HelloWorld ID  类型为uint32_t
			bsTmp & cHelloWorlD_u; // 序列化 类型为uint8_t
			bsTmp & strHelloWorldName; // 序列化 HelloWorld 名称  类型为String
			bsTmp & cHelloWorldName_u; // 序列化 类型为uint8_t
			bsTmp & dwCreateTime; // 序列化 添加时间 类型为uint32_t
			bsTmp & cCreateTime_u; // 序列化 类型为uint8_t
			bsTmp & dwLastUpdateTime; // 序列化 修改时间 类型为uint32_t
			bsTmp & cLastUpdateTime_u; // 序列化 类型为uint8_t
			return bsTmp.isGood();
		}

		const char* GetLastErrMsg() const{
			return m_sLastErrMsg.c_str();
		}

		bool VerifyHelloWorldDdo(){

			if(!IsVersionSet()){
				m_sLastErrMsg = "Miss Param:version";
				return false;
			}

			if(!IsHelloWorldNameSet()){
				m_sLastErrMsg = "Miss Param:helloWorldName";
				return false;
			}

			if(!IsCreateTimeSet()){
				m_sLastErrMsg = "Miss Param:createTime";
				return false;
			}

			if(!IsLastUpdateTimeSet()){
				m_sLastErrMsg = "Miss Param:lastUpdateTime";
				return false;
			}
			return true;
		}

		void DumpData(std::ostream& oss) const{
		
			oss<<"[dwVersion:"<<dwVersion<<"] ";
			oss<<"[cVersion_u:"<<(int)cVersion_u<<"] ";
			oss<<"[dwHelloWorldID:"<<dwHelloWorldID<<"] ";
			oss<<"[cHelloWorlD_u:"<<(int)cHelloWorlD_u<<"] ";
			oss<<"[strHelloWorldName:"<<strHelloWorldName<<"] ";
			oss<<"[cHelloWorldName_u:"<<(int)cHelloWorldName_u<<"] ";
			oss<<"[dwCreateTime:"<<dwCreateTime<<"] ";
			oss<<"[cCreateTime_u:"<<(int)cCreateTime_u<<"] ";
			oss<<"[dwLastUpdateTime:"<<dwLastUpdateTime<<"] ";
			oss<<"[cLastUpdateTime_u:"<<(int)cLastUpdateTime_u<<"] ";
		
		}

		// codydeng提供,非常好的dump方法 ^-^  。。。。。
		template<typename T>
		T & DumpPlusData(T& oss){
			oss<<"dwVersion:"<<dwVersion;
			oss<<"cVersion_u:"<<cVersion_u;
			oss<<"dwHelloWorldID:"<<dwHelloWorldID;
			oss<<"cHelloWorlD_u:"<<cHelloWorlD_u;
			oss<<"strHelloWorldName:"<<strHelloWorldName;
			oss<<"cHelloWorldName_u:"<<cHelloWorldName_u;
			oss<<"dwCreateTime:"<<dwCreateTime;
			oss<<"cCreateTime_u:"<<cCreateTime_u;
			oss<<"dwLastUpdateTime:"<<dwLastUpdateTime;
			oss<<"cLastUpdateTime_u:"<<cLastUpdateTime_u;
			return oss;
		}

		// wileywang提供,树形dump方法 ^-^  。。。。。
		void DumpDataTree(std::ostream& os, int ident = 0)const {
			g_pprint(os, "dwVersion", dwVersion, ident);
			g_pprint(os, "cVersion_u", cVersion_u, ident);
			g_pprint(os, "dwHelloWorldID", dwHelloWorldID, ident);
			g_pprint(os, "cHelloWorlD_u", cHelloWorlD_u, ident);
			g_pprint(os, "strHelloWorldName", strHelloWorldName, ident);
			g_pprint(os, "cHelloWorldName_u", cHelloWorldName_u, ident);
			g_pprint(os, "dwCreateTime", dwCreateTime, ident);
			g_pprint(os, "cCreateTime_u", cCreateTime_u, ident);
			g_pprint(os, "dwLastUpdateTime", dwLastUpdateTime, ident);
			g_pprint(os, "cLastUpdateTime_u", cLastUpdateTime_u, ident);
		}
		
		//提供ToString借口，默认为DumpData格式，请按需要进行修改
		std::string ToString() const{
			std::stringstream ss;
			DumpData(ss);
			return ss.str();
		}

/**
 ********************以下信息是每个版本的字段********************
 */

};

}
}
}

#endif /* ERP_HELLOWORLD_DDO_CHELLOWORLDDDO_BY_AUTOGEN_V5_H */
